<template>
    <div class="appointment-projectbilling">
        <!-- 开单 -->
        <appointmentProjectBilling
            ref="appointmentProjectBilling"
            @submitScheduling="submitScheduling"
            v-show="page_i == 1"
        ></appointmentProjectBilling>
        <!-- 结算 -->
        <settlementPay
            ref="settlementPay"
            v-show="page_i == 2"
            @backFun="backFun2"
            @successfulSettlement="successfulSettlement"
        ></settlementPay>
    </div>
</template>

<script>
import appointmentProjectBilling from "@/components/appointment/appointmentProjectBilling.vue";
import settlementPay from "@/components/appointment/settlementPay.vue";

export default {
    components: {
        appointmentProjectBilling,
        settlementPay,
    },
    data() {
        return {
            page_i: 1,
        };
    },
    onLoad() {
    },
    mounted() {
        this.initData();
    },
    methods: {
        initData() {
            this.$refs.appointmentProjectBilling.initData();
        },
        // 结算页面
        submitScheduling(data) {
            this.page_i = 2;
            this.$refs.settlementPay.initData(data);
        },
        // 结算页面返回
        backFun2() {
            this.page_i = 1;
            this.$refs.appointmentProjectBilling.initData();
        },
        //结算成功
        successfulSettlement(data) {
            this.page_i = 1;
            this.$refs.appointmentProjectBilling.successfulSettlement(data);
        },
    },
};
</script>

<style lang="scss" scoped>
</style>
